
// 保养记录
import qs from 'qs'
import request from "@/utils/request"

/**
 *GET 获取保养记录列表
  * @params

 * @return {*}
 */
export function getMaintenanceRecordList(params) {
  return request({
    url: "/maintenanceRecord/getList?" + qs.stringify(params),
    method: "get",
  })
}

// 获取保养统计报表
export function getMaintenanceRecordReport(timeUnit) {
  return request({
    url: "/maintenanceRecord/getReport?timeUnit=" + timeUnit,
    method: "get",
  })
}

/**
 * 新增保养记录
 * @return {*}
 */
export function addMaintenanceRecord(data) {
  return request({
    url: "/maintenanceRecord/add",
    method: "post",
    data
  })
}

// /**
//  * 修改保养记录
//  * @return {*}
//  */
// export function updateMaintenanceRecord(data) {
//   return request({
//     url: "/maintenanceRecord/update",
//     method: "post",
//     data
//   })
// }


/**
 * 删除保养记录
 * @return {*}
 */
export function deleteMaintenanceById(id) {
  return request({
    url: "/maintenanceRecord/delete?id=" + id,
    method: "delete",
  })
}

//? -------------------------------------------异常项-------------------------------------------


/**
 *GET 获取异常项列表
  * @params

 * @return {*}
 */
export function getExceptionList(params) {
  return request({
    url: "/exceptionItem/getList?" + qs.stringify(params),
    method: "get",
  })
}
/**
 *GET 获取异常项统计报表
  * @params

 * @return {*}
 */
export function getExceptionItemReport(timeUnit) {
  return request({
    url: "/exceptionItem/getReport?timeUnit=" +timeUnit,
    method: "get",
  })
}

/**
 * 新增异常项
 * @return {*}
 */
export function addException(data) {
  return request({
    url: "/exceptionItem/add",
    method: "post",
    data
  })
}

/**
 * 关闭异常项
 * @return {*}
 */
export function closeException(data) {
  return request({
    url: "/exceptionItem/close",
    method: "post",
    data
  })
}

/**
 * 异常转工单
 * @return {*}
 */
export function toWorkOrder(data) {
  return request({
    url: "/exceptionItem/toWorkOrder",
    method: "post",
    data
  })
}

/**
 * 删除异常项
 * @return {*}
 */
export function deleteExceptionById(id) {
  return request({
    url: "/exceptionItem/deletet?id=" + id,
    method: "delete",
  })
}



// ************************************** 点巡检记录 **************************************
/**
 *GET 获取点巡检记录列表
  * @params
 * @return {*}
 */
export function getSpotInspectionRecordList(params) {
  return request({
    url: "/spotInspectionRecord/getList?" + qs.stringify(params),
    method: "get",
  })
}
/**
 *GET 获取点巡检统计报表
  * @params
 * @return {*}
 */
export function getsSotInspectionRecord(timeUnit) {
  return request({
    url: "/spotInspectionRecord/getReport?timeUnit=" + timeUnit,
    method: "get",
  })
}


/**
 * 新增点巡检记录
 * @return {*}
 */
export function addSpotInspectionRecord(data) {
  return request({
    url: "/spotInspectionRecord/add",
    method: "post",
    data
  })
}

// /**
//  * 修改点巡检记录
//  * @return {*}
//  */
// export function updateSpotInspectionRecord(data) {
//   return request({
//     url: "/spotInspectionRecord/update",
//     method: "post",
//     data
//   })
// }

/**
 * 删除点巡检记录
 * @return {*}
 */
export function deleteSpotInspectionRecordById(id) {
  return request({
    url: "/spotInspectionRecord/delete?id=" + id,
    method: "delete",
  })
}
